package gui;
import controladores.ControladorMain;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.WindowConstants;



public class MainGui extends javax.swing.JFrame {

	
	private static final long serialVersionUID = 1L;
	private JButton jButtonAdmin;
	private JButton jButtonAsign;
	private ControladorMain cont;

	public MainGui() {
		super("CURSOS");
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				jButtonAdmin = new JButton();
				getContentPane().add(jButtonAdmin);
				jButtonAdmin.setText("Administracion");
				jButtonAdmin.setBounds(60, 28, 156, 26);
				jButtonAdmin.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jButtonAdmin.actionPerformed, event="+evt);
						cont.procesarAbrirVentanaAdministracion();
					}
				});
			}
			{
				jButtonAsign = new JButton();
				getContentPane().add(jButtonAsign);
				jButtonAsign.setText("Asignaciones");
				jButtonAsign.setBounds(60, 71, 156, 26);
				jButtonAsign.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jButtonAsign.actionPerformed, event="+evt);
						cont.procesarAbrirVentanaAsignacion();
					}
				});
			}
			pack();
			this.setSize(280, 156);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void setControlador( ControladorMain c){
		this.cont = c;
	}
	
	public void anularBotonAdmin(){
		jButtonAdmin.setEnabled(false);	
	}
	public void activarBotonAdmin(){
		jButtonAdmin.setEnabled(true);	
	}
	public void anularBotonAsign(){
		jButtonAsign.setEnabled(false);	
	}
	public void activarBotonAsign(){
		jButtonAsign.setEnabled(true);	
	}

}
